/**
 * JAVACC DEMO 1.0
 */
package com.apache.client;

import com.apache.api.vo.ResultEntity;
import com.apache.uct.common.ToolsUtil;

import java.util.HashMap;
import java.util.Map;

/**
 * description:
 * 创建时间：2016-10-15
 */
public class AttaCoreClient {

    private AttaCoreClient() {
        //AttaCoreClient
    }

    public static ResultEntity getAttachmentList(String objId, String objType) {
        ResultEntity root = null;

        if (ToolsUtil.isNull(objId) || ToolsUtil.isNull(objType)) {
            root = new ResultEntity();
            root.setResult("false");
            root.setMessage("参数不能为空");
        } else {
            Map<String, Object> dataMap = new HashMap<String, Object>();
            dataMap.put("objId", objId);
            dataMap.put("objType", objType);
            root = UctProtoclClient.getInstance()
                    .doService("attachmentService", "attalist", dataMap);
        }

        return root;
    }

    public static ResultEntity delAttaById(String id) {
        ResultEntity root = null;

        if (ToolsUtil.isNull(id)) {
            root = new ResultEntity();
            root.setResult("false");
            root.setMessage("参数不能为空");
        } else {
            Map<String, Object> params = new HashMap<String, Object>();
            params.put("id", id);
            root = UctProtoclClient.getInstance()
                    .doService("attachmentService", "delAttaById", params);
        }
        return root;
    }

    public static ResultEntity delAttaByObjId(String objType, String objId) {
        ResultEntity root = null;

        if (ToolsUtil.isNull(objType) || ToolsUtil.isNull(objId)) {
            root = new ResultEntity();
            root.setResult("false");
            root.setMessage("参数不能为空");
        } else {
            Map<String, Object> params = new HashMap<String, Object>();
            params.put("objType", objType);
            params.put("objId", objId);
            root = UctProtoclClient.getInstance()
                    .doService("attachmentService", "delAttaByObjId", params);
        }
        return root;
    }
}
